const fs = require("fs");

const p = new Promise((resolve, reject) => {
  fs.readFile('./resources/为学.md', (err, data) => {
    if(err) reject(err);
    resolve(data);
  })
});

p.then(value => {
  console.log(value.toString());
  return new Promise((resolve, reject) => {
    fs.readFile('./resources/插秧诗.md', (err, data) => {
      if(err) reject(err);
      resolve(data);
    })
  })
}, reason => {
  console.error(reason);
}).then(value => {
  console.log(value.toString());
  return new Promise((resolve, reject) => {
    fs.readFile('./resources/观书有感.md', (err, data) => {
      if(err) reject(err);
      resolve(data);
    })
  })
}, reason => {
  console.error(reason);
}).then(value => {
  console.log(value.toString());
}, reason => {
  console.error(reason);
})